package com.ytf.test.seventh;

/**
 * @author: YTF
 * @date: 2024/9/26 15:08
 * @version: 1.0
 * @description:
 */
public class Detergent extends Cleanser {

    @Override
    public void scrub(){
        append(" Detergent.scrub()");
        super.scrub();
    }

    public void foam(){
        append(" foam()");
    }

    public static void main(String[] args) {
        Detergent detergent = new Detergent();
        detergent.dilute();
        detergent.apply();
        detergent.scrub();
        detergent.foam();
        System.out.println(detergent);
        System.out.println("Testing base class");
        Cleanser.main(args);
    }
}
class Cleanser{
    private String s = "Cleanser";

    public void append(String a){
        s+=a;
    }

    public void dilute() {
        append("dilute()");
    }
    public void apply() {
        append("apply()");
    }
    public void scrub() {
        append("scrub()");
    }

    public static void main(String[] args) {
        Cleanser cleanser = new Cleanser();
        cleanser.dilute();
        cleanser.apply();
        cleanser.scrub();
        System.out.println(cleanser);
    }

    @Override
    public String toString() {
        return "Cleanser{" +
                "s='" + s + '\'' +
                '}';
    }
}
